import { get, lsGetStr, post } from "../../utils/request.js";
import { getType } from "../../utils/data_type.js";
var { getLoginedUser, setTitle, fnLoading, fnHideLoading, fnSuccess, fnFail } = require('../../utils/index')
Component({
  properties: {
    typeId: {
      type: String,
      value: '',
    }
  },
  data: {
    typeId: "",
    other: "",
    image: "",
    desc1: "",
    price:''
  },
  lifetimes: {
    attached: function () {
    },
    moved: function () {
    },
    detached: function () {
    },
  },
  attached() {
  }, // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready: function () {
    this.setData({
      typeId: this.properties.typeId||''
    })
  },
  methods: {},

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () {
      let that = this;
        get({
          path: "/offer/get?id=" + that.data.typeId
        })
          .then(function (res) {
            that.setData({
              other: res.offer.name,
              image: res.offer.thumbnail,
              desc1: res.offer.desc1,
              price: res.offer.price
            })
            fnHideLoading();

          })
    },
  },
})